[% setvar title length(@ary) deserves a warning %]
<div id="archive-notice">
    <h3>This file is part of the Perl 6 Archive</h3>
    <p>To see what is currently happening visit <a href="http://www.perl6.org/">http://www.perl6.org/</a></p>
</div>
<div class='pod'>
<a name='TITLE'></a><h1>TITLE</h1>
<p>length(@ary) deserves a warning</p>
<a name='VERSION'></a><h1>VERSION</h1>
<pre>  Maintainer: Nathan Torkington &lt;<a href='mailto:gnat@frii.com'>gnat@frii.com</a>&gt;
  Date: 15 Sep 2000
  Mailing List: <a href='mailto:perl6-language-subs@perl.org'>perl6-language-subs@perl.org</a>
  Number: 238
  Version: 1
  Status: Developing
  Supercedes: RFC 212</pre>
<a name='ABSTRACT'></a><h1>ABSTRACT</h1>
<p>Beginners often try <code>length(@ary)</code> (which has bizarre consequences and
no real purpose).  Make it emit a warning.</p>
<a name='DESCRIPTION'></a><h1>DESCRIPTION</h1>
<p>Beginners think of the size of an array as its length, so try to use
the length() function to find this information.  They should be told
by the compiler that this is not correct.</p>
<p>The warning would be triggered when Perl finds an array in scalar
context as the argument to length().  The construct serves no useful
purpose otherwise, so backwards compatibility isn't a problem.</p>
<p>While I originally suggested &quot;just make it work&quot;, this would (1) steer
users away from the real understanding of context; (2) require changes
to the prototype system to permit length() to still be overridable.
While it is a good idea to do what users want, in this case I've been
convinced that the user would benefit from being told the correct way
to do it.</p>
<a name='IMPLEMENTATION'></a><h1>IMPLEMENTATION</h1>
<p>When you check a length() function call, warn if its argument is a
scalar-context array.</p>
<a name='REFERENCES'></a><h1>REFERENCES</h1>
<p>RFC 212: (retired) Make length(@array) work</p>
<p>perlfunc manpage for information on the length() function</p>
</div>
